Introduction#

A hard disk drive (HDD) is a nonvolatile storage device used in computers that persists data in a durable way. IBM introduced HDDs in 1956, and they have since become the dominant secondary storage device for general-purpose computers.

Components#

Let’s take a look at the different components of an HDD and their roles.

Platter#

An HDD consists of one or more circular magnetic plates, called platters, stacked over each other to hold the data. Each platter consists of a nonmagnetic material such as aluminum, glass, or ceramic, coated with a shallow magnetic material 10–20 mm in depth and an outer layer of carbon for protection. Each platter has two working surfaces, one on either side, which holds the actual data.

Spindle#

The stack of platters is held together by a spindle motor, which is responsible for controlling and rotating the platters. Most HDD failures are related to the spindle's inability to spin the platters.

Actuator#

Each platter has an actuator arm positioned on top of it, which is responsible for reading, writing, and deleting the data on its respective platter. Actuator arms are also called read-write arms.

Read-write arms have two separate heads:

  • The read head: Responsible for reading the direction of magnetic current and converting it into bits.

  • The write head: An electromagnet with a coil shape that magnetizes the bits to north facing up (0s) and north facing down (1s) by changing the direction of the current.

An actuator holds the actuator arms responsible for positioning the read-write heads on the spinning platters.

Track, sector, and cylinder#

Each working surface of the platter includes thousands of concentric rings called a track. Each track can hold a large amount of data. Tracks start at 0 outside the platter and go on, increasing to the inner side.

Each track includes thousands of smaller units called sectors. A sector is the fundamental unit of storage on an HDD. The data size of a sector is always a power of 2. A sector can either store 512 or 4096 bytes of data. Each sector contains a sector identifier, actual data, and self-correcting error codes for detecting and correcting the corrupted data. Each track in a platter includes the same number of sectors. However, the platter packs sectors more tightly near the center than around the peripheral.

A cylinder is any set of tracks of equal diameter in an HDD. We can visualize the cylinder as a single, imaginary circle that cuts through the platters.

Track, sector and cylinder
Track, sector and cylinder

Apart from this, a cluster groups sectors in contiguous locations. The actuator is responsible for moving all the heads simultaneously from one cylinder to another.

Components of a HDD
Components of a HDD

Metrics#

Multiple measurements govern the rate at which data can be written and read from a HDD.

Seek time#

The first step in reading and writing to HDD involves positioning the actuator arm on the correct track of the platter, which is essentially the cylinder of all the platters. The time required by the actuator arm to move to the desired track/cylinder is called the seek time.

Rotational latency#

Once the actuator positions the arm onto the right track, the next step is to find the desired sector. The spindle rotates the platter, and the time taken by the actuator arm to move to the required sector is called the rotational latency.

Access time#

Access time is the time required to locate the address from which the desired data should be read or written. Access time is essentially the sum of seek time and rotational latency.

Read time#

The sector is the fundamental unit of storage that can be read from or written to disk. The time required by the actuator arm to read the entire sector is the read time.

Transmission time#

Transmission time is the sum of access time and read time. This is the total amount of time required to read or write data.

CHS addressing#

CHS stands for cylinder, head, and sector. CHS addressing is a scheme to identify a particular sector in a given track and platter to read or write data:

  • The cylinder identifies the tracks inside the platter.

  • The head's value narrows down the location of the platter where the actuator arm or head should read/write the data.

  • Once the platter and the track are known, the sector number pinpoints the actual location of the data transfer.

Read#

This is the sequence of steps involved in reading data from the HDD:

  • The operating system uses Logical Block Addressing (LBA) to resolve the logical blocks into a physical address such as CHS.

  • Once the CHS address is known, the actuator moves the actuator arm to the desired cylinder using the C of the CHS address.

  • Once the actuator arm positions the head on the desired cylinder, it deactivates the remaining head pointers using H of the CHS address. This process eliminates all but the desired platter to read.

  • Once we find the desired platter and track, the actuator arm waits till it positions the head on the required sector using S of the CHS address.

  • Once we find the desired sector, the read head of the actuator arm reads the direction of the magnetic current in the sector, converts it into bits, and returns the data to the client.

Write#

Following is the sequence of steps involved in writing data from the HDD:

  • The operating system uses logical block addressing to resolve the logical blocks into a physical address such as CHS.

  • Once the CHS address is known, the actuator moves the actuator arm to the desired cylinder using the C of the CHS address.

  • Once the actuator arm positions the head on the desired cylinder, it deactivates the remaining head pointers using H of the CHS address. This process eliminates all but the desired platter to write.

  • Once we find the desired platter and track, the actuator arm waits till it positions the head on the required sector using S of the CHS address.

  • Once we find the required sector, the write head of the actuator arm magnetizes the bit into north facing up (0s) and north facing down (1s) in the magnetic platter, and completes the disk write.

Shortcomings of HDD#

The shortcomings of HDDs include:

  • Slow disk access because of the access pattern of HDD. The disk access process involves expensive operations such as actuator arm positioning and rotating the platter to locate the sector. However, once we find the sector, reads/writes on contiguous blocks are very fast. The expensive part of locating the appropriate sector is why much literature recommends sequential disk access.

  • High power consumption in HDDs compared to SSDs.

  • They rely on a delicate magnetic platter, and damage leads to data loss.

  • HDDs fail when the motor stops spinning the platter.

  • An actuator arm crash can damage the entire hard disk.

Quiz on Data Structures Used in Databases

Layout of an SSD